<?php declare(strict_types=1);

namespace App\Helper;

use Hyperf\Di\Annotation\Inject;
use Hyperf\Support\Traits\StaticInstance;
use Hyperf\Validation\Contract\ValidatorFactoryInterface;

class FormValidator
{

    use StaticInstance;

    #[Inject]
    protected ValidatorFactoryInterface $validationFactory;

    final public function validate(array $params, array $rules): array
    {
        return $this->validationFactory->make($params, $rules)->validate();
    }

}